import request from '@/utils/request'

export function getGoodsList(query) {
  return request({
    url: '/goods',
    method: 'get',
    params: query
  })
}

export function getGoodsDetail(id) {
  return request({
    url: `/goods/edit/${id}`,
    method: 'get'
  })
}

export function goodSave(query) {
  return request({
    url: `/goods/save`,
    method: 'post',
    data: query
  })
}

export function orderHandle(query) {
  return request({
    url: `/goodsOrders/orderHandle`,
    method: 'post',
    data: query
  })
}

export function delImg(query) {
  return request({
    url: '/goods/delImg',
    method: 'get',
    params: query
  })
}

export function delGoods(query) {
  return request({
    url: '/goods/delGoods',
    method: 'get',
    params: query
  })
}

export function goodsUpOrDown(query) {
  return request({
    url: '/goods/goodsUpOrDown',
    method: 'get',
    params: query
  })
}

export function mallConfig(query) {
  return request({
    url: '/mall/config',
    method: 'get',
    params: query
  })
}

export function mallConfigSave(query) {
  return request({
    url: `/mall/save`,
    method: 'post',
    data: query
  })
}

export function mallBannerSave(query) {
  return request({
    url: `/mall/mallBannerSave`,
    method: 'post',
    data: query
  })
}

export function delMallBanner(query) {
  return request({
    url: '/mall/delMallBanner',
    method: 'get',
    params: query
  })
}

export function getCategory(parentId = 0) {
  return request({
    url: `/category/category/${parentId}`,
    method: 'get'
  })
}

export function catSave(query) {
  return request({
    url: `/category/save`,
    method: 'post',
    data: query
  })
}

export function getCatList(query) {
  return request({
    url: '/category',
    method: 'get',
    params: query
  })
}

export function deleteCat(query) {
  return request({
    url: '/category/delete',
    method: 'get',
    params: query
  })
}

export function getOrdersList(query) {
  return request({
    url: '/goodsOrders',
    method: 'get',
    params: query
  })
}

export function sendGoods(query) {
  return request({
    url: `/goodsOrders/sendGoods`,
    method: 'post',
    data: query
  })
}

export function newPrice(query) {
  return request({
    url: `/goodsOrders/newPrice`,
    method: 'post',
    data: query
  })
}

export function getTagList(query) {
  return request({
    url: '/goodsTags',
    method: 'get',
    params: query
  })
}

export function tagSave(query) {
  return request({
    url: `/goodsTags/save`,
    method: 'post',
    data: query
  })
}

export function deleteTag(query) {
  return request({
    url: '/goodsTags/delete',
    method: 'get',
    params: query
  })
}

export function bannerGoods(query) {
  return request({
    url: '/goods/bannerGoods',
    method: 'get',
    params: query
  })
}

export function afreshSort() {
  return request({
    url: '/category/afreshSort',
    method: 'get'
  })
}
